//package com.njcky.model;
//
////import com.yutu.map.service.enums.GeoCompareEnum;
////import com.yutu.map.service.enums.SqlAndOrEnum;
//import com.njcky.model.enums.GeoCompareEnum;
//import com.njcky.model.enums.SqlAndOrEnum;
//import com.yutu.map.service.exception.MapServiceException;
////import com.yutu.map.service.model.GeoValueCompareModel;
//import io.swagger.annotations.ApiModelProperty;
//import lombok.Data;
//import org.apache.commons.lang3.StringUtils;
//
//import java.math.BigDecimal;
//import java.util.HashMap;
//
//@Data
//public class GeoCompareModel {
//    @ApiModelProperty("空间关系参数")
//    private GeoValueCompareModel geoValueFilter;
//    @ApiModelProperty("多条件之间的关联关系：or|and，枚举类型")
//    private SqlAndOrEnum orAnd;
//    private static HashMap<String, String> geoFilterConfig = new HashMap<String, String>() {
//        {
//            GeoCompareEnum[] values = GeoCompareEnum.values();
//            GeoCompareEnum[] var2 = values;
//            int var3 = values.length;
//
//            for(int var4 = 0; var4 < var3; ++var4) {
//                GeoCompareEnum value = var2[var4];
//                this.put(value.getDesc(), value.getSign());
//            }
//
//        }
//    };
//
//    String generateGeoFilterSQL() {
//        String sql = "";
//        if (!StringUtils.isEmpty(this.geoValueFilter.getXzqhdm())) {
//            sql = "xzqhdm = '" + this.geoValueFilter.getXzqhdm() + "'";
//        } else if (this.geoValueFilter.getGeoCompareEnum() == GeoCompareEnum.BUFFER) {
//            BigDecimal radius = new BigDecimal(this.geoValueFilter.getRadius());
//            String radiusStr = radius.divide(new BigDecimal(111120), 16, 4).toString();
//            sql = "public.st_intersects(".concat(((String)geoFilterConfig.get(this.geoValueFilter.getGeoCompareEnum().getDesc())).replace("{rings}", this.geoValueFilter.getGeoValue()).replace("{SRID}", this.geoValueFilter.getSrid()).replace("{RADIUS}", radiusStr)).concat(",shape)");
//        } else {
//            if (StringUtils.isEmpty(this.geoValueFilter.getGeoValue()) || this.geoValueFilter.getGeoCompareEnum() == null || StringUtils.isEmpty(this.geoValueFilter.getSrid()) || this.geoValueFilter.getGeoValue().equals("\"\"")) {
//                throw new MapServiceException("未正确传入空间数据或空间关系或坐标系");
//            }
//
//            sql = ((String)geoFilterConfig.get(this.geoValueFilter.getGeoCompareEnum().getDesc())).replace("{rings}", this.geoValueFilter.getGeoValue());
//            sql = sql.replace("{SRID}", this.geoValueFilter.getSrid());
//        }
//
//        if (StringUtils.isEmpty(sql)) {
//            return sql;
//        } else if (this.orAnd == null) {
//            return "(" + sql + ")";
//        } else {
//            sql = "(" + sql + ")" + this.orAnd.getSign();
//            return sql;
//        }
//    }
//}
